<?
global $topdir,$db,$topurl;
#$node = $db->query1("select * from node where id = ".$db->sqlint($params["id"]));

$title = "pygame news";
$desc = "";

include_once "$topdir/ext/feedcreator/feedcreator.class.php";


inc_inclib("image.php");

if (!$_REQUEST["format"]) { $_REQUEST["format"] = "RSS0.91"; }
$format = $_REQUEST["format"];
$fname = "$topdir/cache/news-$format";

$rss = new UniversalFeedCreator();
#$rss->useCached($format,$fname);

$rss->title = $title;
$rss->description = $desc;
$rss->descriptionHtmlSyndicated = true;
$rss->link = $topurl;
$rss->syndicationURL = $_SERVER["REQUEST_URI"];

$image = new FeedImage();
$image->title = $title;
$image->url = "$topurl/skins/main/poweredby.gif";
$image->link = "$topurl";
$image->description = $desc;
$image->descriptionHtmlSyndicated = true;
$rss->image = $image;

// get your news items from somewhere, e.g. your database:
$r = $db->query("select * from news where datetimeon <= now() order by datetimeon desc limit 20");
foreach ($r as $e) {
    $item = new FeedItem();
    $item->title = $e["title"];
    $item->link = "$topurl/news.html";
    
    ob_start();
    
    #echo "<img src=\"$topurl/thumb/".image_thumb("$topdir/content/{$e["image"]}",120,120)."\" align=right>";
    $content = $e["description"];
    $content = str_replace("<p>&nbsp;</p>","",$content);
    echo "<div>$content</div>";

/*    inc_incfile("rating.php",array(
        "count"=>0,
        "record"=>$e,
        ));*/
    $content = ob_get_contents();
    ob_end_clean();
    
    $item->description = $content;
    
    $item->descriptionHtmlSyndicated = true;
    $item->date = strtotime($e["datetimeon"]);
    $item->source = $topurl;
    $item->author = "pygame.org";
    #$image = new FeedImage();
    #$image->url = "$topurl/content/{$e["image"]}";
    #$item->image = $image;
    $rss->addItem($item);
}

$rss->saveFeed($format, $fname);

?>